/*
 * Copyright (c) 2015. For Intelligent Group.
 */

package com.intelligent.ispc.core.entity;

import com.google.common.collect.Lists;
import com.intelligent.ispc.common.persistence.BaseEntity;
import com.intelligent.ispc.utils.DDCategory;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.util.List;

/**
 * Created by Peter.Li on 2015/10/30.
 */
@Entity
@Table(name = "td_datadictionary")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class DataDictionary extends BaseEntity {

    @Enumerated(EnumType.STRING)
    private DDCategory category;

    private String attributeName;
    private String attributeValue;
    private String attributeClass;

    @ManyToOne
    @JoinColumn(name = "parent_id")
    private DataDictionary parent;

    @OneToMany(mappedBy = "parent")
    private List<DataDictionary> subDataDictionaries = Lists.newArrayList();

    public DDCategory getCategory() {
        return category;
    }

    public void setCategory(DDCategory category) {
        this.category = category;
    }

    public String getAttributeName() {
        return attributeName;
    }

    public void setAttributeName(String attributeName) {
        this.attributeName = attributeName;
    }

    public String getAttributeValue() {
        return attributeValue;
    }

    public void setAttributeValue(String attributeValue) {
        this.attributeValue = attributeValue;
    }

    public String getAttributeClass() {
        return attributeClass;
    }

    public void setAttributeClass(String attributeClass) {
        this.attributeClass = attributeClass;
    }

    public DataDictionary getParent() {
        return parent;
    }

    public void setParent(DataDictionary parent) {
        this.parent = parent;
    }

    public List<DataDictionary> getSubDataDictionaries() {
        return subDataDictionaries;
    }

    public void setSubDataDictionaries(List<DataDictionary> subDataDictionaries) {
        this.subDataDictionaries = subDataDictionaries;
    }
}
